import Vue from 'vue'
import VueRouter from 'vue-router'
import defaultPage from '../views/default'
import blackPage from '../views/blank'
import Index from '@/page/index.vue'
import goodsList from '@/page/goodsList.vue'
import ChangeCity from '@/page/changeCity.vue'

import Login from '@/page/login.vue'
import Register from '@/page/register.vue'

Vue.use(VueRouter)

const routes = [

  {
    path: '/',
    name: 'default',
    component: defaultPage,
    redirect: '/index',
    children: [{
      path: '/index',
      name: 'index',
      component: Index
    }, {
      path: 's/:name',
      name: 'goods',
      component: goodsList
    }, {
      path: '/changeCity',
      name: 'changeCity',
      component: ChangeCity
    }]
  },
  {
    path: '/blank',
    name: 'blackPage',
    component: blackPage,
    children: [{
      path: '/login',
      name: 'login',
      component: Login
    }, {
      path: '/register',
      name: 'register',
      component: Register
    }]
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
